var nowing='1';//1可以执行  2 执行中
var page=1;//定位当前页数
var index = 1;
var forEnd =0;
var showPage=10;//初始化最多显示的页数
var showPageCount=10;//初始化每页显示的条数

initMenu();//初始化二级菜单

//初始化二级菜单
function initMenu(){
	$.ajax({
		  type: "post",
		  url: "../menu/querySecondMenuQian",
		  data: {
			  'parentId':parent
			  },
		  dataType: "json",
		  success: function(data){
			  var parentMenu = data.parentMenu;//父级菜单
			  var menuList = data.menuList;//二级菜单集合
			  $("#modulename").html(parentMenu.text);
			  $("#titleId").html(parentMenu.text);
			  $("#textbluebId").html(parentMenu.text);
			  
			  var menuStr ='';
			   $.each(menuList, function(index, entity){ 
				   var houUrl=entity.houUrl;
				   var shuzu =[];
				   shuzu = houUrl.split('ckType=');
				   var cktype = '';
				   if(shuzu.length>=2){
					   cktype=shuzu[1];
					   var shuzu2 = [];
					   shuzu2 = cktype.split('&');
					   if(shuzu2.length>=1){
						   cktype=shuzu2[0];
					   }
				   }
				   
				   if(entity.id=='86'||entity.id==86){
					   menuStr+='<a href="page_service_message.html?type='+cktype+'&menu='+entity.id+'&parent=85"><li id="id'+cktype+'" class='
					   +(entity.id==menu?"presentnav":"")
					   +'>'
					   +entity.text
					   +'</li></a>';
				   }
			    })
			    $("#pagenavId").append(menuStr); 
		  }
	  }) 
	  
}

//发送信息
function MsgSend(){
	var jshm = $("#jshm").val().replace(/\s/g, "");
	var fsnr = $("#fsnr").val().replace(/\s/g, "");
	
	var isture= yzparms(jshm,fsnr);
	if(isture==false){
		alert("请输入接收人号码和发送信息的内容！")
		return;
	}
	fsnr=encodeURI(fsnr);
	
	$.ajax({
		  type: "post",
		  url: "../MsgSendService/MsgSend",
		  data: {
			  'jshm':jshm,
			  'fsnr':fsnr
		  },
		  dataType: "json",
		  success: function(data){
			  var row = data.row;
			  var mess = data.mess;
			  if(mess=="未登录"){
				  alert('请先登录！');
				  MM_showHideLayers('loginbg','','show');
			  }
			if(mess=="无权限"){
				  alert('无权限！');
				 
			  }			  
			if(row==1){
				  alert("发送成功");
				  var menu = "";
				  location.href="page_service_message.html?parent=84&menu=85";
			  }else{
				  alert("发送失败");
			  }
		  }
	})
}
function yzparms(jshm,fsnr){
	if(jshm==''){
		$("#jshm").css("border-color","red");
	}else{
		$("#jshm").css("border-color","#cccccc");
	}
	if(fsnr==''){
		$("#fsnr").css("border-color","red");
	}else{
		$("#fsnr").css("border-color","#cccccc");
	}
	if(jshm==''|| fsnr==''){
		return false;
	}
}